package jok.net;

import java.net.InetAddress;
import java.net.UnknownHostException;

public class InetAddressDemo {

	public static void main(String[] args) throws UnknownHostException {

		InetAddress ia = InetAddress.getLocalHost();
		System.out.println(ia.getHostAddress());// 192.168.1.20
		System.out.println(ia.getHostName());// X1C

		InetAddress ia2 = InetAddress.getByName("X1C");
		System.out.println(ia2);// X1C/192.168.1.20

		InetAddress ia3 = InetAddress.getByName("192.168.1.20");
		System.out.println(ia3);// /192.168.1.20
	}
}
